<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" xmlns:sec="http://www.thymeleaf.org/extras/spring-security">
<head th:replace="common/head :: head"></head>
<body>

<div th:replace="common/header :: header"></div>

<div class="layui-hide-xs">
  <div th:replace="common/column :: column"></div>
</div>

<div class="layui-container">
  <div class="layui-row layui-col-space15">
    <div class="layui-col-md8 content detail">
      <div class="fly-panel detail-box">
        <h1 th:text="${jie.jieTitle}"></h1>
        <div class="fly-detail-info">
          <!-- <span class="layui-badge">审核中</span> -->
          <span th:text="${jie.getColumnType().describe}" class="layui-badge layui-bg-green fly-detail-column"></span>

          <span th:if="${!jie.jieStatus?.jieEnd }" class="layui-badge" style="background-color: #999;">未结</span>
          <span th:if="${jie.jieStatus?.jieEnd }"  class="layui-badge" style="background-color: #5FB878;">已结</span>

          <span th:if="${jie.jieStatus?.jieTop}" class="layui-badge layui-bg-black">置顶</span>
          <span th:if="${jie.jieStatus?.jieEssence}" class="layui-badge layui-bg-red">精帖</span>

          <div class="fly-admin-box" th:attr="data-id=${jie.jieId}" data-id="123">
            <span sec:authorize="hasRole('admin')" class="layui-btn layui-btn-xs jie-admin" type="del">删除</span>

            <span sec:authorize="hasRole('admin')" th:if="${!jie.jieStatus?.jieTop}" class="layui-btn layui-btn-xs jie-admin" type="set" jieTop="true">置顶</span>
            <span sec:authorize="hasRole('admin')" th:if="${jie.jieStatus?.jieTop}" class="layui-btn layui-btn-xs jie-admin"  type="set" jieTop="false" style="background-color:#ccc;">取消置顶</span>

            <span sec:authorize="hasRole('admin')" th:if="${!jie.jieStatus?.jieEssence}" class="layui-btn layui-btn-xs jie-admin" type="set"  jieEssence="true">加精</span>
            <span sec:authorize="hasRole('admin')" th:if="${jie.jieStatus?.jieEssence}" class="layui-btn layui-btn-xs jie-admin"  type="set"  jieEssence="false" style="background-color:#ccc;">取消加精</span>
          </div>
          <span class="fly-list-nums">
            <a href="#comment"><i class="iconfont" title="回答" >&#xe60c;</i> <span th:id="jiedaCount" th:text="${jie.jieStatus?.jieReplyNumber} "></span></a>
            <i class="iconfont" title="人气" >&#xe60b;</i> [[${jie.jieStatus?.jieLookNumber}]]
          </span>
        </div>
        <div class="detail-about">
          <a class="fly-avatar" th:href="@{'/user/name/'+ ${jie.jieUser?.userNickName}}" href="../user/home.html">
            <img th:src="@{${jie.jieUser?.userAvatar }}" th:alt="${jie.jieUser?.userNickName}">
          </a>
          <div class="fly-detail-user">
            <a th:href="@{'/user/name/'+ ${jie.jieUser?.userNickName}}" href="../user/home.html" class="fly-link">
              <cite th:text="${jie.jieUser?.userNickName}">贤心</cite>
              <!--              <i class="iconfont icon-renzheng" title="认证信息：{{ rows.user.approve }}"></i>-->
              <!--              <i class="layui-badge fly-badge-vip">VIP3</i>-->
            </a>
            <span th:text="${#temporals.format(jie.getJieCreateTime(), 'yyyy-MM-dd HH:mm')}">2017-11-30</span>
          </div>
          <div class="detail-hits" id="LAY_jieAdmin" th:attr="data-id=${jie.jieId}" data-id="123">
            <span style="padding-right: 10px; color: #FF7200" >悬赏：[[${jie.rewardValue?.describe}]] 元气</span>
            <span sec:authorize="isAuthenticated()" th:if="${jie.jieUser?.userId == #authentication.principal?.user?.userId}" class="layui-btn layui-btn-xs jie-admin" type="edit"><a th:href="@{'/jie/update/'+${jie.jieId}}">编辑此贴</a></span>
          </div>
        </div>
        <!-- 内容 -->
        <div class="detail-body photos" th:text="${jie.jieContent}"></div>
      </div>

      <div class="fly-panel detail-box" id="flyReply">
        <fieldset class="layui-elem-field layui-field-title" style="text-align: center;">
          <legend>回帖</legend>
        </fieldset>

        <ul class="jieda" id="jieda">
          <li th:attr="data-id=${reply.replyId}" data-id="111" class="jieda-daan" th:each="reply : ${replyList}">
            <a th:name="${'item-'+reply.replyId}" name="item-1111111111"></a>
            <div class="detail-about detail-about-reply">
              <a class="fly-avatar" th:href="@{'/user/name/'+ ${reply?.user?.userNickName}}" href="">
                <img th:src="${reply.user?.userAvatar}"  th:alt="${reply?.user?.userNickName}">
              </a>
              <div class="fly-detail-user">
                <a href="" th:href="@{'/user/name/'+ ${reply?.user?.userNickName}}" class="fly-link">
                  <cite th:text="${reply.user?.userNickName}">贤心</cite>
                  <!--                  <i class="iconfont icon-renzheng" title="认证信息：XXX"></i>-->
                  <!--                  <i class="layui-badge fly-badge-vip">VIP3</i>-->
                </a>

                <span sec:authorize="isAuthenticated()" th:if="${reply.user?.userId == #authentication.principal?.user?.userId}">(楼主)</span>
                <!--                <span style="color:#5FB878">(管理员)</span>-->
                <!--                <span style="color:#FF9E3F">（社区之光）</span>-->
                <!--                <span style="color:#999">（该号已被封）</span>-->
              </div>

              <div class="detail-hits">
                <span th:text="${#temporals.format(reply.replyTime, 'yyyy-MM-dd HH:mm')}">2017-11-30</span>
              </div>

              <i th:if="${reply.replyAdoptStatus}" class="iconfont icon-caina" title="最佳答案"></i>
            </div>
            <div class="detail-body jieda-body photos" th:text="${reply.replyContent}"> </div>
            <div class="jieda-reply">
              <span class="jieda-zan" type="zan">
                <i class="iconfont icon-zan"></i>
                <em th:text="${reply.getReplyLikeNumber()}">66</em>
              </span>
              <span type="reply" sec:authorize="isAuthenticated()" th:if="${reply.user.userId != #authentication.principal?.user?.userId}">
                <i class="iconfont icon-svgmoban53"></i>
                回复
              </span>
              <div class="jieda-admin">
                <!--<span sec:authorize="hasRole('admin')" type="edit">编辑</span>-->
                <span sec:authorize="hasRole('admin')" type="del">删除</span>
                <span sec:authorize="isAuthenticated()" th:if="${!jie.jieStatus?.jieAdopt && jie.jieUser?.userId == #authentication.principal?.user?.userId && jie.jieUser.userId != reply.user.userId}" class="jieda-accept" type="accept">采纳</span>
              </div>
            </div>
          </li>
          <!-- 无数据时 -->
          <li th:if="${#lists.isEmpty(replyList)}" class="fly-none">消灭零回复</li>
        </ul>

        <div th:if="${!#lists.isEmpty(replyList) && pageInfo.total > 10}" style="text-align: center">
          <div  style="text-align: center">
            <div class="laypage-main">
              <a th:href="@{'/q/jie/'+${jie.jieId}+'/page/' + ${pageInfo.getPrePage()}}" th:if="${pageInfo.hasPreviousPage}" class="laypage-prev">上一页</a>
              <a th:href="@{'/q/jie/'+${jie.jieId}+'/page/1'}" th:if="${pageInfo.pageNum > 1}" class="laypage-prev">首页</a>
              <span th:if="${pageInfo.pageNum > 3}">…</span>
              <th:block th:each="num : ${pageInfo.navigatepageNums}">
                <span th:if="${num == pageInfo.pageNum}"  th:text="${replyList.pageNum}" class="laypage-curr"></span>
                <a th:href="@{'/q/jie/'+${jie.jieId}+'/page/' + ${num}}" th:if="${num != pageInfo.pageNum}" th:text="${num}"></a>
              </th:block>
              <span th:if="${(pageInfo.pageNum + 2) < pageInfo.pages}">…</span>
              <a th:href="@{'/q/jie/'+${jie.jieId}+'/page/' + ${pageInfo.pages}}" th:if="${pageInfo.hasNextPage}" class="laypage-last" title="尾页">尾页</a>
              <a th:href="@{'/q/jie/'+${jie.jieId}+'/page/' + ${pageInfo.nextPage}}" th:if="${pageInfo.hasNextPage}" class="laypage-next">下一页</a>
            </div>
          </div>
        </div>
        <div class="layui-form layui-form-pane">
          <form action="/jie/reply" method="post">
            <div class="layui-form-item layui-form-text">
              <a name="comment"></a>
              <div class="layui-input-block">
                <textarea id="L_content" name="content" required lay-verify="required" placeholder="请输入内容"  class="layui-textarea fly-editor" style="height: 150px;"></textarea>
              </div>
            </div>
            <div class="layui-form-item">
              <input type="hidden" name="page" th:value="${pageInfo.pages}">
              <input type="hidden" name="jieId" th:value="${jie.jieId}">
              <button class="layui-btn" lay-filter="*" lay-submit>提交回复</button>
            </div>
          </form>
        </div>
      </div>
    </div>


    <div class="layui-col-md4">

      <!-- 技术类型查询条件 -->
      <div th:replace="common/right-block :: technologyType"></div>

      <div th:replace="common/right-block :: hongbao"></div>

    </div>
  </div>
</div>

<div th:replace="common/footer :: footer"></div>
<script th:replace="common/common-js :: js"></script>
<script>
  layui.config({
    base: '/res/mods/'
  }).extend({
    fly: 'index'
  }).use(['fly', 'face','jie'], function(){
    var $ = layui.$
            ,fly = layui.fly;
    //如果你是采用模版自带的编辑器，你需要开启以下语句来解析。
    $('.detail-body').each(function(){
      var othis = $(this), html = othis.html();
      othis.html(fly.content(html));
    });
  });
</script>

</body>
</html>